package com.lee.forum.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //文件磁盘图片url 映射
        // linux
//        registry.addResourceHandler("/userPhoto/**").addResourceLocations("file:/forumImage/");
//        registry.addResourceHandler("/codeimg/**").addResourceLocations("file:/root/forum1.0/forumcheckImage/");
//        registry.addResourceHandler("/mdimage/**").addResourceLocations("file:/root/forum1.0/editorImage/");

        // windows
        registry.addResourceHandler("/userPhoto/**").addResourceLocations("file:D:/forumImage/");
        registry.addResourceHandler("/codeimg/**").addResourceLocations("file:D:/forumImage/");
        registry.addResourceHandler("/mdimage/**").addResourceLocations("file:D:/forumImage/");

    }
}
